This tutorial focuses on pre-calculated outcome data meta-analysis
using the R meta package.
library(meta)
library(readxl)
=(event.e / (n.e - event.e)) / (event.c / (n.c - event.c))
=SQRT((1/event.e) + (1/(n.e - event.e)) + (1/event.c) + (1/(n.c - event.c)))
=(event.e / n.e) / (event.c / n.c)
=SQRT((1/event.e) - (1/n.e) + (1/event.c) - (1/n.c))
The entire dataset was converted into a dataframe format for easier handling and compatibility with the R example analysis. The dataframe structure allows seamless data manipulation and analysis using R’s built-in functions and packages.
ma$rr
## Author Year TE seTE lower upper n.e n.c Subgroup_1 Variable_1
## 1 Study 1 2015 1.5 NA 0.95 2.38 150 150 Drug A 70
## 2 Study 2 2014 0.8 NA 0.47 1.35 120 130 Drug A 80
## 3 Study 3 2018 2.0 NA 1.35 2.96 200 210 Drug B 50
## 4 Study 4 2013 1.2 0.2087 NA NA 180 190 Drug B 20
To perform the meta-analysis of ratio measures we will use the
metagen() function from the meta package. We
need to provide some instructions for the metagen()
function. These instructions are known as arguments, which can be one,
two, three, or more inputs that the function uses to perform its task.
The main arguments of the metagen() function are:
m.rr<-metagen(TE=log(TE), seTE=seTE, lower=log(lower), upper=log(upper),
n.e=n.e, n.c=n.c,
studlab = Author,
data = ma$rr,
method.tau = "REML",
sm = "OR")
To visualize the results of a meta-analysis conducted with the
metagen() function, we will use the summary()
function. It will generate a summary of the analysis:
summary(m.rr)
## OR 95%-CI %W(common) %W(random)
## Study 1 1.5000 [0.9500; 2.3800] 22.8 24.4
## Study 2 0.8000 [0.4700; 1.3500] 17.3 21.8
## Study 3 2.0000 [1.3500; 2.9600] 31.2 27.3
## Study 4 1.2000 [0.7971; 1.8065] 28.7 26.5
##
## Number of studies: k = 4
## Number of observations: o = 1330 (o.e = 650, o.c = 680)
##
## OR 95%-CI z p-value
## Common effect model 1.3806 [1.1088; 1.7191] 2.88 0.0039
## Random effects model 1.3335 [0.9242; 1.9241] 1.54 0.1240
##
## Quantifying heterogeneity:
## tau^2 = 0.0883 [0.0000; 2.0189]; tau = 0.2972 [0.0000; 1.4209]
## I^2 = 63.0% [0.0%; 87.5%]; H = 1.64 [1.00; 2.83]
##
## Test of heterogeneity:
## Q d.f. p-value
## 8.11 3 0.0438
##
## Details on meta-analytical method:
## - Inverse variance method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-Profile method for confidence interval of tau^2 and tau
To create the forest plot, we will use the forest()
function. Alongside this function, we will include specific arguments to
customize the appearance and content of the forest plot, such as labels,
confidence interval formatting, and display options. These arguments
ensure the plot is clear, informative, and tailored to the dataset being
analyzed.
forest(m.rr,
smlab = "Arrhythmia Recurrence",
layout = "Revman5",
sortvar = TE,
lab.e = "Experimental", label.left = "Favors Experimental",
lab.c = "Control", label.right = "Favors Control",
ff.lr = "bold",
leftcols = c("studlab", "Year", "n.e", "n.c", "w.random", "effect", "ci"),
leftlabs = c("Studies", "Year", "Experimental\nTotal", "Control\nTotal", NA, NA, NA),
text.random = "Random effects model",
random = TRUE,
common = FALSE,
test.overall.random = TRUE,
rightcols = FALSE,
colgap = "3mm",
fs.heading = 12,
fs.study = 12,
fs.hetstat = 10,
digits = 2,
digits.pval = 2,
pooled.totals = TRUE,
col.square="darkcyan", col.square.lines="black",
prediction = TRUE, col.predict = "#CEF2EE",col.predict.lines = "black", ff.predict = 1)
=mean.e - mean.c
=SQRT(((sd.e)ˆ2/n.e) + ((sd.c)ˆ2/n.c))
The entire dataset was converted into a dataframe format for easier handling and compatibility with the R example analysis. The dataframe structure allows seamless data manipulation and analysis using R’s built-in functions and packages.
ma$los
## Author Year TE seTE lower upper n.e n.c Subgroup_1 Variable_1
## 1 Study 1 2015 -0.27 NA -0.62 0.08 30 30 Drug A 70
## 2 Study 2 2014 0.16 0.1173 NA NA 50 50 Drug A 80
## 3 Study 3 2018 -0.24 NA -1.40 0.92 25 25 Drug B 50
## 4 Study 4 2013 -0.45 NA -0.79 -0.11 280 280 Drug B 20
To perform the meta-analysis of difference measures we will use the
metagen() function from the meta package. We
need to provide some instructions for the metagen()
function. These instructions are known as arguments, which can be one,
two, three, or more inputs that the function uses to perform its task.
The main arguments of the metagen() function are:
m.los<-metagen(TE=TE, seTE=seTE, lower=lower, upper=upper,
n.e=n.e, n.c=n.c,
studlab = Author,
data = ma$los,
method.tau = "REML",
sm = "MD")
To visualize the results of a meta-analysis conducted with the
metagen() function, we will use the summary()
function. It will generate a summary of the analysis:
summary(m.los)
## MD 95%-CI %W(common) %W(random)
## Study 1 -0.2700 [-0.6200; 0.0800] 22.4 28.8
## Study 2 0.1600 [-0.0699; 0.3899] 51.9 34.9
## Study 3 -0.2400 [-1.4000; 0.9200] 2.0 7.0
## Study 4 -0.4500 [-0.7900; -0.1100] 23.7 29.3
##
## Number of studies: k = 4
## Number of observations: o = 770 (o.e = 385, o.c = 385)
##
## MD 95%-CI z p-value
## Common effect model -0.0890 [-0.2546; 0.0765] -1.05 0.2919
## Random effects model -0.1704 [-0.5077; 0.1668] -0.99 0.3219
##
## Quantifying heterogeneity:
## tau^2 = 0.0710 [0.0012; 0.8987]; tau = 0.2665 [0.0350; 0.9480]
## I^2 = 69.8% [13.1%; 89.5%]; H = 1.82 [1.07; 3.09]
##
## Test of heterogeneity:
## Q d.f. p-value
## 9.93 3 0.0192
##
## Details on meta-analytical method:
## - Inverse variance method
## - Restricted maximum-likelihood estimator for tau^2
## - Q-Profile method for confidence interval of tau^2 and tau
To create the forest plot, we will use the forest()
function. Alongside this function, we will include specific arguments to
customize the appearance and content of the forest plot, such as labels,
confidence interval formatting, and display options. These arguments
ensure the plot is clear, informative, and tailored to the dataset being
analyzed.
forest(m.rr,
smlab = "Length of Stay",
layout = "Revman5",
sortvar = TE,
lab.e = "Experimental", label.left = "Favors Experimental",
lab.c = "Control", label.right = "Favors Control",
ff.lr = "bold",
leftcols = c("studlab", "Year", "n.e", "n.c", "w.random", "effect", "ci"),
leftlabs = c("Studies", "Year", "Experimental\nTotal", "Control\nTotal", NA, NA, NA),
text.random = "Random effects model",
random = TRUE,
common = FALSE,
test.overall.random = TRUE,
rightcols = FALSE,
colgap = "3mm",
fs.heading = 12,
fs.study = 12,
fs.hetstat = 10,
digits = 2,
digits.pval = 2,
pooled.totals = TRUE,
col.square="darkcyan", col.square.lines="black",
prediction = TRUE, col.predict = "#CEF2EE",col.predict.lines = "black", ff.predict = 1)
In meta-analyses, studies may report confidence intervals (CIs) with different levels of confidence (e.g., 90%, 95%, or 99%). To standardize the data for analysis, you must first calculate the Standard Error for all studies using their reported CIs, regardless of the confidence level. Once the SE is calculated, the treatment effect and its SE can be used uniformly in the metagen() function.
=(log(Upper_CI) - log(Lower_CI))/3.29
=(Upper_CI - Lower_CI)/3.29
=(log(Upper_CI) - log(Lower_CI))/3.92
=(Upper_CI - Lower_CI)/3.92
=(log(Upper_CI) - log(Lower_CI))/5.15
=(Upper_CI - Lower_CI)/5.15
When the sample size in each group is small (e.g., fewer than 60 participants per group), confidence intervals should be calculated using the t-distribution instead of the normal distribution. The constants 3.92 , 3.29 , and 5.15 (derived from the normal distribution) must be replaced with larger values specific to the t distribution, accounting for the sample size and degrees of freedom (df).
Before calculating the t statistic and subsequent SE for confidence intervals, it is essential to clearly define: (a) Confidence level; (b) Sample size in control (n.c) and experimental (n.e) group
In an Excel cell, type the following formula using the variables:
=tinv(1-CI, n.e+n.c-2)
Calculate the SE Using the t-Statistic:
=(log(Upper_CI) - log(Lower_CI))/2*t
=(Upper_CI - Lower_CI)/2*t